﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WcfTranslateLibrary
{
	[ServiceContract(Namespace = "www.skype.com/translationservice", SessionMode = SessionMode.Allowed)]
	public interface ITranslateService
	{
		[OperationContract]
		TranslationResponse Translate(TranslationRequest request);

		[FaultContract(typeof(ArgumentNullException))]
		[FaultContract(typeof(VoiceFault))]
		[OperationContract]
		VoiceResponse GetVoice(VoiceRequest request);
	}

	[DataContract(Namespace = "www.skype.com/translationservice")]
	public class TranslationResponse
	{
		[DataMember(Order = 0)]
		public string OriginalText { get; set; }
		[DataMember(Order = 1)]
		public string TranslationResult { get; set; }
		[DataMember(Order = 2)]
		public string FromToLanguage { get; set; }
	}

	[DataContract(Namespace = "www.skype.com/translationservice")]
	public class VoiceResponse
	{
		[DataMember(Order = 0)]
		public byte[] Data { get; set; }
	}

	[DataContract(Namespace = "www.skype.com/translationservice")]
	public class VoiceRequest
	{
		[DataMember(Order = 0)]
		public string OriginalText { get; set; }
		[DataMember(Order = 1)]
		public string ToLanguage { get; set; }
	}

	[DataContract(Namespace = "www.skype.com/translationservice")]
	public class TranslationRequest
	{
		[DataMember(Order = 0)]
		public string Content { get; set; }
		[DataMember(Order = 1)]
		public string FromLanguage { get; set; }
		[DataMember(Order = 2)]
		public string ToLanguage { get; set; }
	}

	[DataContract(Namespace = "www.skype.com/translationservice")]
	public class VoiceFault
	{
		[DataMember]
		public string Issue { get; set; }

		[DataMember]
		public string Details { get; set; }
	}

}
